<html lang="en" xmlns="http://www.w3.org/1999/xhtml"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:o="http://omnifaces.org/ui" 
	xmlns:p="http://primefaces.org/ui"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions">

<h:form id="searchEleveForm" autocomplete="off">
	<c:if test="#{fn:contains(menudetaileleve, 'EleveDetailMenu')}">
		<div class="panel panel-primary">
				<div class="panel-heading">#{text['eleveDetail.heading']}</div>
					<div class="panel-body">
						<div class="row">
							<div class="col-sm-5 form-group">
								<p:graphicImage cache="false" styleClass="img-rounded"
									url="#{paiementController.eleve.imageToDisplay}"
									 width="100%"/>
							</div>
							
							<div class="col-sm-7 form-group">
								 <h4>
					            	<h:outputText id="fullNameDetail" value="#{paiementController.eleve.fullName}" escape="true"/>
					            </h4>
				            	<h:outputText id="classeHeader" value="#{paiementController.eleve.groupe.classe.nomClasse}" escape="true"/>
				            	<br/>
				            	<h:outputText id="libelleGroupeHeader" value="#{paiementController.eleve.groupe.libelleGroupe}" escape="true"/>
			           	 	</div>
						</div>
						
						<div class="row">
							<div class="col-sm-12 form-group">
								<c:if test="#{paiementController.eleve.exonere}">
				            		<h4>#{text['eleve.is.exonere']}</h4>
				            	</c:if>
				            </div>
						</div>
						
						<div class="row">
							<div class="col-sm-12">
								<h:commandLink action="#{eleveController.printAttestationScolaire}"  rendered="#{p:ifGranted('ROLE_ADMIN')}">
									<span class="label label-primary">
							  			<span class="glyphicon glyphicon-file"/> #{text['button.print.attestation.scolaire']}
							  			<f:param name="id" value="#{paiementController.paiement.eleve.id}" />
							  		</span>
						  		</h:commandLink>
							</div>
						</div>
			       </div>
	    </div> 
    </c:if>
	<div class="panel panel-primary">
			<div class="panel-heading">#{text['menu.top.eleve.search']}</div>
				<div class="panel-body">
					<c:choose>
						<c:when test="#{!fn:contains(menudetail, 'EleveDetailMenu')}">
							<div class="row">
								<div class="col-sm-12 form-group">
					                <p:watermark for="numeroInscription" value="#{text['eleve.numeroInscription']}" />
									<h:inputText id="numeroInscription" value="#{eleveController.eleve.numeroInscription}" placeholder="#{text['eleve.numeroInscription']}" styleClass="form-control input-sm" required="false" maxlength="15" />
				              	</div>
				            </div>
						    
						    <div class="row">        
				              	<div class="col-sm-12 form-group">
				                  	<p:watermark for="nom" value="#{text['eleve.nom']}" />
									<h:inputText id="nom" value="#{eleveController.eleve.nom}" styleClass="form-control input-sm" required="false" maxlength="50" />
				              	</div>
				            </div>
				            
				             <div class="row">
				             	 <div class="col-sm-12 form-group">
					                  	<h:selectOneMenu id="classe" styleClass="form-control input-sm" value="#{eleveController.eleve.groupe.classe.id}">
											<f:selectItem itemLabel="#{text['form.select.classe']}" itemValue="" />
											<f:selectItems value="#{eleveController.classes}" var="classe" itemLabel="#{classe.nomClasse}" itemValue="#{classe.id}" />
											<p:ajax partialSubmit="true" update="groupe" listener="#{eleveController.handleGroupeChange}" />
										</h:selectOneMenu>
					              </div>
		    					</div>
						       
						       <div class="row">    
					              <div class="col-sm-12 form-group">
					                 	<h:selectOneMenu id="groupe" styleClass="form-control input-sm" value="#{eleveController.eleve.groupe.id}">
											<f:selectItem itemLabel="#{text['form.select.groupe']}" itemValue="" />
											<f:selectItems value="#{eleveController.groupes}" var="groupe" itemLabel="#{groupe.libelleGroupe}" itemValue="#{groupe.id}" />
										</h:selectOneMenu>
				             	</div>
				           		</div>
						             
		             		<div id="actions" class="btn-group col-md-offset-1">
			              		<h:commandButton value="#{text['button.search']}" styleClass="btn btn-default" action="#{eleveController.search}" />
			              		<h:commandButton value="#{text['button.clear']}" styleClass="btn btn-primary" action="#{eleveController.clearForm}" />
			              	</div>
						</c:when>
						<c:otherwise>
							<div class="input-group text-right">
								<p:watermark for="numeroInscriptionHeader" value="#{text['eleve.numeroInscription']}" />
							    <h:inputText id="numeroInscriptionHeader" onkeypress="if (event.keyCode == 13) {return false; }" value="#{paiementController.eleve.numeroInscription}" styleClass="form-control"/>
							    <span class="input-group-btn">
							      <h:commandButton styleClass="btn btn-primary" action="#{paiementController.handleNumeroInscriptionChange}" value="#{text['button.search']}"/>
							    </span>
						    </div>
						</c:otherwise>
					</c:choose>
				
		       </div>
       </div>  
       
       <div class="panel panel-primary">
		<div class="panel-heading">#{text['menu.top.eleve']}</div>
		<div class="panel-body">
			<ul class="nav nav-pills nav-stacked">
				<li class="#{fn:contains(menuleft, 'ElevesMenu') ? 'active' : ''}">
					<h:commandLink action="/eleves" value="#{text['menu.top.eleve.list']}"/>
				</li>
				<li class="#{fn:contains(menuleft, 'ListRetardPayMenu') ? 'active' : ''}">
					<h:commandLink action="/listRetardPay.xhtml" value="#{text['menu.left.list.retard']}"/>
				</li>
				<li class="#{fn:contains(menuleft, 'EleveFormMenu') ? 'active' : ''}">
					<h:commandLink rendered="#{p:ifGranted('ROLE_ADMIN')}" action="#{eleveController.viewEleveForm}" value="#{text['menu.top.eleve.add']}"/>
				</li>
				<li class="#{fn:contains(menuleft, 'PaiementFormMenu') ? 'active' : ''}">
					<h:commandLink rendered="#{p:ifGranted('ROLE_ADMIN')}" action="#{paiementController.edit}" value="#{text['menu.top.paiement.add']}"/>
				</li>
				<li class="#{fn:contains(menuleft, 'ImportMenu') ? 'active' : ''}">
					<h:commandLink action="/import.xhtml" value="#{text['menu.admin.import.eleves']}"/>
				</li>
			</ul>
		</div>
	</div>
</h:form>
</html>